package com.codeforces.contest.c296;

import java.util.Scanner;


public class _296A {

	static Scanner scanner = new Scanner(System.in);
	static int n;
	static int[] num = new int[200];
	static int[] count = new int[2000];

	public static void main(String[] args) {
		n = scanner.nextInt();
		for (int i=1;i<=n;++i) {
			num[i] = scanner.nextInt();
			count[num[i]]++;
			if (n % 2 == 0) {
				if (count[num[i]] > n/2) {
					System.out.println("NO");
					return;
				}
			}
			else {
				if (count[num[i]] > (n+1)/2) {
					System.out.println("NO");
					return;
				}
			}
		}
		System.out.println("YES");
	}

}
